<template>
	<view class="navBarLayout">
		<div class="statusBar" :style="{height: statusBarHeight() + 'px'}"></div>
		<div class="navBar" 
			:style="{height: navBarHeight() + 'px', marginLeft: getLeftIcon() + 'px'}"
		>
			<view class="title">
				<slot name="title"></slot>
			</view>
			<view class="search" @click="scan">
				<uni-icons type="search" size="18" color="#a7a7a7"></uni-icons>
				<view class="text">
					搜索
				</view>
			</view>
		</div>
	</view>
	<view class="fill" :style="{height: navBarHeight() + statusBarHeight() + 'px'}"></view>
</template>

<script setup>
import { statusBarHeight, navBarHeight, getLeftIcon } from '../../utils/system';
import { ref } from 'vue';

const keyword = ref('')
const scan = () => {
	uni.getUserInfo({
		success: (res) => {
			console.log(res);
		}
	})
}
</script>

<style lang="scss" scoped>
	.navBarLayout {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		z-index: 2;
		background:
		linear-gradient(to bottom, transparent ,#fff 400rpx),
		linear-gradient(to right, #beecd8 20%, #f4e2d8);
	}
.navBar {

	display: flex;
	align-items: center;
	padding: 0 30rpx;
	height: 100rpx;
	.title {
		font-size: 50rpx;
	}
	.search {
		margin-left: 30rpx;
		background-color: #eee;
		border: 1px solid #fff;
		display: flex;
		align-items: center;
		width: 220rpx;
		height: 55rpx;
		padding: 6rpx 30rpx 6rpx 20rpx;
		border-radius: 30rpx;
		font-size: 28rpx;
		color: $text-font-color-3;
		.text {
			margin-left: 10rpx;
		}
	}
}
</style>